
/*------------------------------------------------------------------------------

This is the master file.

------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------

DIRECTORIES

------------------------------------------------------------------------------*/

* Define root directory where the replication folder is located
cd "FILL IN ROOT DIRECTORY"

* Folder with raw data
global source "source"

* Folder to save intermediate data files
global output "output"
capture mkdir output

* Folder to save results
global results "results"
capture mkdir results



/*------------------------------------------------------------------------------

PROGRAMS

------------------------------------------------------------------------------*/

* winsorizing

capture program drop winsor
program define winsor
qui sum `1', d
qui gen `1'_w1 = `1'
qui replace `1'_w1 = r(p1) if `1'<r(p1)
qui replace `1'_w1 = r(p99) if `1'<. & `1'>r(p99)
qui gen `1'_w5 = `1'
qui replace `1'_w5 = r(p5) if `1'<r(p5)
qui replace `1'_w5 = r(p95) if `1'<. & `1'>r(p95)
end




/*------------------------------------------------------------------------------

DATA ANALYSIS

------------------------------------------------------------------------------*/

* Extract and clean regulatory filings

run "dofiles/01_RegulatoryFilings.do"


* Summary stats using regulatory filings
*	Table 1 Panel A
*	Figure 1
*	Figure 2
*	Figure B1
*	Figure B2
*	Figure B3

run "dofiles/02_SummaryStats.do"



* Inter-cohort redistribution
*	Table 2

run "dofiles/03_InterCohortRedistribution.do"



* Main regressions
*	Table 6
*	Table 7
*	Figure 3
*	Table 5
*	Table E2
*	Table E5
*	Table 9
*	Table E4
*	Table 8

run "dofiles/04_Regressions.do"



* Summary stats and regressions using prospectus data
*	Table 1 Panel B
*	Table 4 Columns 1-2
*	Table E1

run "dofiles/05_ProspectusData.do"


* Summary stats and regressions using survey data
*	Table 1 Panel C
*	Table 4 Column 3
*	Table 10

run "dofiles/06_SurveyData.do"

